import { IPSApplication } from '.';
import { ModelServiceStore } from './core';
import { IPSAppView, IPSAppDataEntity } from './exports';
import { IPSModelObject } from './ipsmodel-object';
import { IPSModelService } from './ipsmodel-service';
import { IPSModelServiceProxy } from './ipsmodel-service-proxy';

/**
 *
 *
 * @export
 * @class PSModelServiceProxyImpl
 * @implements {IPSModelServiceProxy}
 */
export class PSModelServiceProxyImpl implements IPSModelServiceProxy {
  protected iPSModelService: IPSModelService = null;
  protected tag: any = null;
  get store(): ModelServiceStore {
    return this.getRealPSModelService().store;
  }
  get app(): IPSApplication {
    return this.getRealPSModelService().app;
  }

  init(iPSModelService: IPSModelService, tag: any): void {
    this.iPSModelService = iPSModelService;
    this.tag = tag;
  }

  getRealPSModelService(): IPSModelService {
    return this.iPSModelService;
  }

  // getRealModel(relatedPSModelObject: IPSModelObject, objectNode: any) {
  //   return this.getRealPSModelService().getRealModel(relatedPSModelObject, objectNode);
  // }

  getModel(relatedPSModelObject: IPSModelObject, filePath: string) {
    return this.getRealPSModelService().getModel(
      relatedPSModelObject,
      filePath,
    );
  }

  getPSModel4(
    relatedPSModelObject: IPSModelObject,
    cls: string,
    objNode: any,
    strTag: string,
  ): IPSModelObject {
    return this.getRealPSModelService().getPSModel4(
      relatedPSModelObject,
      cls,
      objNode,
      strTag,
    );
  }

  getPSModel5(
    relatedPSModelObject: IPSModelObject,
    cls: string,
    list: any[],
    objKey: any,
  ): IPSModelObject {
    return this.getRealPSModelService().getPSModel5(
      relatedPSModelObject,
      cls,
      list,
      objKey,
    );
  }

  getRealObjectNode(obj: IModel): IModel {
    return this.getRealPSModelService().getRealObjectNode(obj);
  }

  getPSApplication(): IPSApplication {
    return this.getRealPSModelService().getPSApplication();
  }

  getChildPSModelObject(
    relatedPSModelObject: IPSModelObject,
    cls: string,
    objNode: IModel,
  ): IPSModelObject {
    return this.getRealPSModelService().getChildPSModelObject(
      relatedPSModelObject,
      cls,
      objNode,
    );
  }

  getParentPSModelObject(
    relatedPSModelObject: IPSModelObject,
    cls: string,
  ): IPSModelObject {
    return this.getRealPSModelService().getParentPSModelObject(
      relatedPSModelObject,
      cls,
    );
  }

  getPSAppView(obj: IModel): Promise<IPSAppView>;
  getPSAppView(strPath: string): Promise<IPSAppView>;
  getPSAppView(strPath: any): Promise<IPSAppView> {
    return this.getRealPSModelService().getPSAppView(strPath);
  }
  getPSAppDataEntity(obj: IModel): Promise<IPSAppDataEntity>;
  getPSAppDataEntity(strPath: string): Promise<IPSAppDataEntity>;
  getPSAppDataEntity(strPath: any): Promise<IPSAppDataEntity> {
    return this.getRealPSModelService().getPSAppDataEntity(strPath);
  }

  getPSAppCodeList(strPath: string): IPSModelObject {
    return this.getRealPSModelService().getPSAppCodeList(strPath);
  }

  getPSAppFunc(tag: string): IPSModelObject {
    return this.getRealPSModelService().getPSAppFunc(tag);
  }

  getPSUIAction(tag: string): IPSModelObject {
    return this.getRealPSModelService().getPSUIAction(tag);
  }

  getPSAppViewPath(tag: string): string {
    return this.getRealPSModelService().getPSAppViewPath(tag);
  }

  getPSLang(key: string): string {
    return this.getRealPSModelService().getPSLang(key);
  }
}
